% This program is the test of Saturated Vapor Pressure
% clc
% clear

% var_name = 'phi';
var_name = 'phit';
% var_name = 'zonal_wind';
% var_name = 'meridional_wind';
% var_name = 'vorticity';
it       = 4;

gravity = 9.80616;

nc_file = '..\run\hope_output.nc';

dx         = ncreadatt(nc_file,'/','dx');
case_num   = ncreadatt(nc_file,'/','case_num');

lon = double(ncread(nc_file,'lon'));
lat = double(ncread(nc_file,'lat'));
var = double(squeeze(ncread(nc_file,var_name,[1,1,1,1,it],[Inf,Inf,Inf,Inf,1])));

nx = size(var,1);
ny = size(var,2);

lon1d = reshape(lon,[],1);
lat1d = reshape(lat,[],1);
var1d = reshape(var,[],1);

lon(lon<0) = 360 + lon((lon<0));
xs = 0;
xe = 360;
    
res = dx/4;
x   = xs:res:xe;
y   = -90:res:90;

[lon2d,lat2d] = meshgrid(x,y);

var_plot = griddata(lon1d,lat1d,var1d,lon2d,lat2d,'linear');

figure
plt = pcolor(lon2d,lat2d,var_plot);
% shading interp
set(plt,'EdgeColor','None')
% set(gca,'CLim',[ 7.8494e+04,1.0350e+05])
% set(gca,'CLim',[ 4.9e4,5.9e4])
% set(gca,'CLim',[ 3e4,5e4])
colormap(jet)

figure
plot(var(:,ny/2,3))

% hold on
% plot(p_WENO2D(:,Ny/2,3),'r','LineWidth',1.5)
% plot(p_WENO3 (:,Ny/2,3),'k','LineWidth',1.5)
% plot(p_WENO5 (:,Ny/2,3),'m','LineWidth',1.5)
% plot(p_poly  (:,Ny/2,3),'b','LineWidth',1.5)
% plot(p_WLS   (:,Ny/2,3),'g','LineWidth',1.5)
